/**
 * There are <a href="https://github.com/thinkgem/jeesite">JeeSite</a> code generation
 */
package com.chlitina.store.modules.expert.entity;

import java.util.Date;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;

import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import org.hibernate.annotations.NotFound;
import org.hibernate.annotations.NotFoundAction;

import com.chlitina.store.common.persistence.BaseEntity;
import com.chlitina.store.modules.base.entity.Customer;
import com.chlitina.store.modules.employee.entity.Employee;
import com.chlitina.store.modules.sys.entity.Store;

/**
 * 专家人工服务Entity
 * @author lvbo
 * @version 2013-06-15
 */
@Entity
@Table(name = "expert_manual_service")
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
public class ExpertManualService extends BaseEntity {
	
	private static final long serialVersionUID = 1L;
	private Long id; 		// 编号
	private Store store; 		// 门店
	private Employee employee; 		// 店员
	private Customer customer; 		// 客户
	private Date askDatetime; 		// 请求时间
	private Date answerDatetime; 	//答复时间
	private String question; // 请求问题
	private String answer;	// 答复问题
	private int status;	// 状态：	0 - 未答复	1 - 已答复

	public ExpertManualService() {
		this.askDatetime = new Date();
		this.status = 0;
	}

	public ExpertManualService(Long id){
		this();
		this.id = id;
	}
	
	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	//@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "seq_expert_expertManualService")
	//@SequenceGenerator(name = "seq_expert_expertManualService", sequenceName = "seq_expert_expertManualService")
	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	@ManyToOne(cascade={CascadeType.REFRESH}, fetch = FetchType.LAZY)
	@JoinColumn(name="STORE_ID")
	@NotFound(action = NotFoundAction.IGNORE)
	@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
	@NotNull
	public Store getStore() {
		return store;
	}

	public void setStore(Store store) {
		this.store = store;
	}

	@ManyToOne(cascade={CascadeType.REFRESH}, fetch = FetchType.LAZY)
	@JoinColumn(name="EMPLOYEE_ID", nullable=true)
	@NotFound(action = NotFoundAction.IGNORE)
	@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
	public Employee getEmployee() {
		return employee;
	}

	public void setEmployee(Employee employee) {
		this.employee = employee;
	}

	@ManyToOne(cascade={CascadeType.REFRESH}, fetch = FetchType.LAZY)
	@JoinColumn(name="CUSTOMER_ID")
	@NotFound(action = NotFoundAction.IGNORE)
	@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
	@NotNull
	public Customer getCustomer() {
		return customer;
	}

	public void setCustomer(Customer customer) {
		this.customer = customer;
	}

	@Column(name="ask_datetime")
	public Date getAskDatetime() {
		return askDatetime;
	}

	public void setAskDatetime(Date askDatetime) {
		this.askDatetime = askDatetime;
	}

	@Column(name="answer_datetime", nullable=true)
	public Date getAnswerDatetime() {
		return answerDatetime;
	}

	public void setAnswerDatetime(Date answerDatetime) {
		this.answerDatetime = answerDatetime;
	}

	public String getQuestion() {
		return question;
	}

	public void setQuestion(String question) {
		this.question = question;
	}
	
	@Column(nullable=true)
	public String getAnswer() {
		return answer;
	}

	public void setAnswer(String answer) {
		this.answer = answer;
	}

	public int getStatus() {
		return status;
	}

	public void setStatus(int status) {
		this.status = status;
	}
	
}


